import request from '@/api/utils/requery'

//人员管理

// 获取学科用户
export const GetSubjectUser = data => {
    return request({
        method:'post',
        url:`subject/selectBySubjectId?id=${data}`
    })
}

// 发送通知
export const SendNote = (x1,x2,x3) => {
    return request({
        method: 'post',
        url:`message/sendNotification?managerName=${x1}&&content=${x2}&&users=${x3}`
    })
}

//删除用户
export const DeleteUser = data => {
    return request({
        url:`user/delete?id=${data}`
    })
}

//修改用户
export const UpdateUser = (data) => {
    return request({
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        url: "/user/update",
        data: data,
    })
}

//用户分页
export const SelectUser = (x1,x2,x3,x4,x5) => {
    return request({
        method: 'post',
        url:`user/selectAllUserPro?subjectId=${x1}&&allotStatus=${x2}&&selectByCondition=${x3}&&pageNum=${x4}&&pageSize=${x5}`
    })
}

//获取已经拥有的角色
export const SearchUser = data => {
    return request({
        method: 'post',
        url:`role/selectOne?userId=${data}`
    })
}

//查看所有角色
export const WatchAllUser = () => request({
    url:"role/selectAll"
})

//添加一个角色
export const AddUserCha = (id,data) => {
    return request({
        method: "post",
          headers: {
            "Content-Type": "application/json",
          },
          url: `role/permission?userId=${id}`,
          data: data,
    })
}

//移除一个角色
export const RemoveUserCha = (id,data) => {
    return request({
        method: "post",
          headers: {
            "Content-Type": "application/json",
          },
          url: `role/cancel?userId=${id}`,
          data: data,
    })
}

//获取所有学科
export const GetAllSubject = () => request({
    method:'post',
    url:"subject/selectAllSub"
})

//获取项目组
export const GetProjectItem = () => request({
    method:'post',
    url:"project/selectAllProject?name="
})

//获取所有用户
export const AllUsers = () => request({
    url:"user/selectAllUser"
})

//用户激活
export const ActiveUser = data => request({
    url:`user/active?id=${data}`
})